<?
$config=ccdsConfig::getInstance();

require_once( $config->get( 'SMARTY_DIR' ) . 'Smarty.class.php' );
unset( $config );

class ccdsSmarty
    extends Smarty
{


/* ---------------------------------------------------------------------------------------------------------------------------------- */

    private $name="ccdsSmarty";
    private $smarty;

    //
    function __construct( )
    {
        $this->config=ccdsConfig::getInstance();

        $this->template_dir=$this->config->get( "TPL_DIR" );
        $this->compile_dir=$this->config->get( 'SMARTY_COMPILE_DIR' );
        $this->cache_dir=$this->config->get( 'SMARTY_CACHE_DIR' );
        $this->config_dir=$this->config->get( 'SMARTY_CONFIG_DIR' );
        $this->caching=0;
        $this->compile=0;

        $this->assign( "WEB_ROOT", $this->config->get( "WEB_ROOT" ) );
        $this->assign( "DOC_ROOT", $this->config->get( "DOC_ROOT" ) );

        $this->assign( "CMS_WEB_ROOT", $this->config->get( "WEB_ROOT" ) );

        $this->assign( "WEB_DIR", $this->config->get( "WEB_DIR" ) );
        $this->assign( "MEDIA_DIR", $this->config->get( "MEDIA_DIR" ) . "/" );
        $this->assign( "CMS_MEDIA_DIR", $this->config->get( "MEDIA_DIR" ) . "/" );
        $this->assign( "MEDIA_ROOT", $this->config->get( "MEDIA_ROOT" ) . "/" );
        $this->assign( "MEDIA_WEB", $this->config->get( "MEDIA_WEB" ) . "/" );
        $this->assign( "CMS_MEDIA_WEB", $this->config->get( "MEDIA_WEB" ) . "/" );
        $this->assign( "LIBRARY_WEB", $this->config->get( "LIBRARY_WEB" ) );

        $this->assign( "CMS_TPL_DIR", $this->config->get( "TPL_DIR" ) );

        $this->assign( "CMS_LIBRARY_WEB", $this->config->get( "LIBRARY_WEB" ) );

        $this->assign( "EXTENSION_DIR", $this->config->get( "EXTENSION_DIR" ) );
        $this->assign( "CMS_EXTENSION_DIR", $this->config->get( "EXTENSION_DIR" ) );
    }

    static function &getInstance( )
    {
        static $obj;

        if ( !$obj )
        {
            $obj=new ccdsSmarty();
        }
        return $obj;
    }
}
